1. Field of the Invention
The invention relates generally to communication between processes and, more specifically, to a method for optimizing network traffic in distributed systems.
2. Background Art
Modem enterprise applications are typically implemented as multi-tier systems. Multi-tier systems serve the end-user through a tree of client/server pairs. Enterprise systems are typically implemented with a number of components, where each component may contain multiple object instances at runtime. The components are distributed across the client/server pairs. At runtime, each component interacts with other components in the system to provide a set of functions to the system. Typically, a component will require multiple interacts with other components to accomplish a given task.
FIG. 1 shows distributed components 2, 4 in a client/server environment. The component 2 is the client, and the component 4 is the server. The client component 2 uses services from the server component 4 in order to provide functions to the system. As an example, the client component 2 may be a web component hosted on a web server 6, and the server component 4 may be an application component hosted on an application server 8. The client component 2 may contain the logic required to display content on a web browser 10. In order to generate content for the web browser 10, the client component 2 would typically need to access enterprise data, which may be held within a database 12 or within some other persistent data store. The client component 2 interacts with the enterprise data in the database 12 through the server component 4. At runtime, the server component 4 includes one or more objects 14, which may be persistent objects that model data within the database 12 or transient objects that can perform operations such as reading or writing from the database 12 or executing business logic.
At runtime, the client component 2 and the server component 4 belong to different address spaces, which may be in the same machine or in different machines connected by a network link, such as network link 16. Before the client component 2 can invoke a method of a server object 14, the server object 14 must exist in the server component 4. If the server object 14 is not already in the server component 4, the client component 2 needs to call on other objects already in the server component 4 to create the server object 14. Typically, the client component 2 calls on an object factory 18 that knows how to create the server object 14. Once the server object 14 is created or found, the client component 2 can invoke a method of the server object 14 by sending a message to the server object 14. Typically, the client component 2 locates the server object 14 through an object location service 20 that keeps track of the location of all distributed objects in the system. The server object 14 executes the operation requested by the client component 2 and returns the result to the client component 2.
One of the important aspects of distributed applications is remote transparency, i.e., the ability to hide the fact that an object may be located on a different machine, allowing local objects to send messages to the remote object as though the remote object were in the same execution space. Before the client component 2 can send a message to the server object 14, it must know the reference to the server object 14. If the client component 2 and server component 4 are hosted on separate machines, the reference to the server object 14 will be remote, which means that some form of remote procedure call is needed to invoke methods of the server object 14. The client component 2 achieves remote transparency by calling into a stub object 14S, which is a local representation of the server object 14 and implements the visible interface of the server object 14. The stub object 14S forwards the request from the client component 2 to the server object 14 over the network link 16. The stub object 14S also receives the response from the server object 14 over the network link 16 and passes the response to the client component 2. Communication between the stub object 14S and the server object 14 is transparent to the client component 2.
The client component 2 can retrieve or update data contained within the server object 14 by invoking get (accessor) or set (mutator) methods, respectively, on the server object 14. The programmer can use a natural object-oriented coding style for client access of server data, which is terribly inefficient. As a trivial example, the client code below requires six network calls just to access its minimal server data:
cust = getCustRef(custID);name = cust.getName( );addr = cust.getAddr( );salesName = cust.getSales( ).getName( );. . . cust.putName(name);cust.putAddr(addr);
Such inefficient distribution code would result in excessive remote calls from the client to the server, which will degrade the scalability and performance of the distributed application. For optimal distribution performance, all needed data should be fetched from and then later stored back to the server with just a single network call. In between, this data should be cached and accessed on the client side as local proxy objects.
The approach described above requires the design of an optimized server application programmer interface (API) and the client proxies for the application. There are software patterns that provide guidelines for hand written optimization at the application design/development stage. See, for example, Martijn Res, “Reduce EJB Network Traffic with Astral Clones,” JavaWorld, December 2000. However, it should be noted that the design of an efficient API, such as suggested above, is too hard to accomplish by hand, particularly because the work must be repeatedly performed as the application evolves and is enhanced. For existing applications, i.e., applications that are compiled and ready-to-run, developing an efficient API would mean a total rewrite of the application. This is typically not an attractive option where considerable time and money have been spent on the existing application or resources to develop a new application are not available.